public class Main {
    public static void main(String[] args) {
        //1、定义一个人类（Person),描述该类的姓名、年龄、身高、体重的特征，定义一个方法(check)来检验人的体重是否在正常范围内，再定义一个方法(out)用于输出个人资料。
        //体重指数计算公式：体重（kg)/(身高(m)的平方）
        //正常：18-25
        //偏瘦：<18
        //偏胖：>25
        Person person = new Person("张三",18,1.8,90);
        person.check();
        person.out();
    }
}

class Person{
    String name;
    int age;
    double high;
    double weight;

    public Person() {
    }

    public Person(String name, int age, double high, double weight) {
        this.name = name;
        this.age = age;
        this.high = high;
        this.weight = weight;
    }

    public void check(){
        double ans = this.weight/Math.pow(this.high,2);
        System.out.println(ans);
        if(ans>25){
            System.out.println("偏胖");
        } else if (ans>=18) {
            System.out.println("正常");
        } else{
            System.out.println("偏瘦");
        }
    }

    public void out() {
        System.out.println("Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", high=" + high + "m" +
                ", weight=" + weight + "kg" +
                '}');
    }
}